package business.impl;

import java.sql.ResultSet;
import java.util.List;

import model.AnnexB;
import model.TCurriculum;
import model.VCurriculum;
import business.basic.iHibBaseDAO;
import business.basic.iHibBaseDAOImpl;
import business.dao.CurriculumDao;

public class CurriculumDaoImpl implements CurriculumDao {
	
	iHibBaseDAO bdao = null;
	public void setBdao (iHibBaseDAO bdao){
		this.bdao=bdao;
		
	}

	@Override
	public TCurriculum getCurriculumById(int id) {
		TCurriculum title = (TCurriculum) bdao.findById(TCurriculum.class,id);
		return title;
	}

	@Override
	public int addCurriculum(TCurriculum model) {
		Object obj = bdao.insert(model);
		if (obj == null) {
			return 0;
		}
		return 1;
	}

	@Override
	public boolean upCurriculum(TCurriculum model) {
		return bdao.update(model);
	}

	@Override
	public boolean delWork(int id) {
		return bdao.delete(TCurriculum.class, id);
	}

	@Override
	public List<VCurriculum> getCurriculums(int id) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public List<VCurriculum> getCurlistByte(int id) {
		String sql = "from VCurriculum"
				+ " where teacherid = ? ";
		Object[] para = {id};
		List<VCurriculum>  modl = bdao.select(sql,para);	
		return modl;
	}

	@Override
	public List<VCurriculum> getCurlist() {
		String sql = "from VCurriculum ";
		List<VCurriculum>  modl = bdao.select(sql);	
		return modl;
	}

}
